<template>
    
    <el-popover  placement="bottom" width="350" trigger="hover" class="">
        <update :hideExpire="true"></update>
        <el-button slot="reference" type="text" class="ml10" size="mini">交流/更新</el-button>
    </el-popover>
</template>

<script>
import update from '~/pages/update'

export default {
    components:{
        update
    },
    data() {
        return {
        }
    },
    inject: ['cfg',"isQry","getSleepTime","isMoneyException","addException"],
    

    mounted() {
    },

    methods: {
        saveConfig(){
            this.$emit("saveConfig")
        },
        tipsTest(){
            if(!window.electron){
                return;
            }
            electron.ipcRenderer.send("showBox","提示信息测试");
        },
        dbAddTest(){
            if(!window.electron){
                return;
            }
            var that = this;
            var param = {type:"insertHis",name:"insertHis",objInfo:{tradeno:22,day:33,time:44,code:55,name:66}};
            electron.ipcRenderer.send("doSql",param)
            
            this.registerListen(this,param.name,(res)=>{
                try{
                    console.info(param.name+'Res dbdata:',res);
                    if(res.succ){
                        that.$message.success(JSON.stringify(res.data));
                    }else{
                        that.$message.error(res.err)
                    }
                }catch(ex){
                    that.$message.error("查询异常:"+ex.message)
                }
            });
        },
        dbQryTest(){
            if(!window.electron){
                return;
            }
            var that = this;
            var param = {type:"queryHis",name:"queryHis",objInfo:{day:"20001028"}};
            electron.ipcRenderer.send("doSql",param)
            
            this.registerListen(this,param.name,(res)=>{
                try{
                    console.info(param.name+'Res dbdata:',res);
                    if(res.succ){
                        that.$message.success("查询成功"+JSON.stringify(res.data));
                    }else{
                        that.$message.error(res.err)
                    }
                }catch(ex){
                    that.$message.error("查询异常:"+ex.message)
                }
            });
        },
        dbConTest(){

            if(!window.electron){
                return;
            }
            var that = this;
            electron.ipcRenderer.send("reCon","")
            
            this.registerListen(this,"reCon",(err)=>{
                try{
                    if(err){
                        that.$message.error("数据读取异常:"+err)
                    }else{
                        that.$message.success("数据读取成功");
                    }
                }catch(ex){
                    that.$message.error("数据读取异常:"+ex.message)
                }
            });
        },
    }
}
</script>


